package com.example.viewmodelstudio.ViewModel.one;

import android.app.Application;
import android.content.Context;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.ViewModel;
//如果要是用Context 就不能用ViewModel 否则会内存溢出的
public class MyViewModel extends AndroidViewModel {
    public int number;

    public MyViewModel(@NonNull Application application) {
        super(application);
    }

    public int addNumber() {
        return ++number;
    }
    public void androidContext(){
        Application application = this.getApplication();
        Context applicationContext = application.getApplicationContext();
    }

}
